import { MockMethod } from 'vite-plugin-mock'
import { mock, Random } from 'mockjs'

var data = mock({
    'list|10': [
        {
            goods: Random.cname(),
            prices: 3000
        }
    ]
})

export default [
    {
        url: '/api/get',
        method: 'get',
        response: ({ query }) => {
            return {
                code: 0,
                data: data,
            }
        },
    },
    {
        url: '/api/data1',
        method: 'get',
        response: ({ query }) => {
            return {
                code: 0,
                data: mock({
                    'record|50-60': [
                        {
                            titleEn: "@title",
                            titleCh: "@csentence",
                            description: "@cparagraph(10)",
                            displayName: '@cname',
                            userName: '@name',
                            address: '@city(true)',
                            id: '@increment(1)',
                            datetime: "@datetime(yyyy-MM-dd HH:mm:ss)",
                            thumb: "@image('200x100', '#50B347', '#FFF', 'Mock.js')",
                            url: "@url",
                            ip: "@ip",
                            email: "@email",
                            guid: "@guid",
                            uid: "@float",
                            float: '@float(60, 100)'
                        }
                    ]
                })
            }
        },
    },
    {
        url: '/api/data2',
        method: 'get',
        response: ({ query }) => {
            return {
                code: 0,
                data: mock({
                    'record|50-60': [
                        {
                            id: '@increment(1)',
                            datetime: "@datetime(2022-MM-dd HH:mm:ss)",
                            param1: '@float(0, 100,2,2)',
                            param2: '@float(0, 100,2,2)',
                            param3: '@float(0, 100,2,2)',
                        }
                    ]
                })
            }
        },
    },
] as MockMethod[]